package be.novelfaces.component.util.attribute;

public enum AttributeType {
	
	ID("id"),
	AUTOCOMPLETE("autocomplete"),
	CLASS("class", "styleClass"),
	VALUE("value"),
	NAME("name", "clientId"),
	GLOBAL_ACCESSKEY("accesskey"),
	GLOBAL_CONTENTEDITABLE("contenteditable"),
	GLOBAL_CONTEXTMENU("contextmenu"),
	GLOBAL_DIR("dir"),
	GLOBAL_DRAGGABLE("draggable"),
	GLOBAL_DROPZONE("dropzone"),
	GLOBAL_HIDDEN("hidden"),
	GLOBAL_LANG("lang"),
	GLOBAL_SPELLCHECK("spellcheck"),
	GLOBAL_STYLE("style"),
	GLOBAL_TABINDEX("tabindex"),
	GLOBAL_TITLE("title"),
	FORM_EVENT_ONBLUR("onblur", events("blur")),
	FORM_EVENT_ONCHANGE("onchange", events("valueChange", "change")),
	FORM_EVENT_ONCONTEXTMENU("oncontextmenu", events("contextmenu")),
	FORM_EVENT_ONFOCUS("onfocus", events("focus")),
	FORM_EVENT_ONFORMCHANGE("onformchange", events("formchange")),
	FORM_EVENT_ONFORMINPUT("onforminput", events("forminput")),
	FORM_EVENT_ONINPUT("oninput", events("input")),
	FORM_EVENT_ONINVALID("oninvalid", events("invalid")),
	FORM_EVENT_ONSELECT("onselect", events("select")),
	FORM_EVENT_ONSUBMIT("onsubmit", events("submit")),
	MOUSE_EVENT_ONCLICK("onclick", events("click")),
	MOUSE_EVENT_ONDBLCLICK("ondblclick", events("dblclick")),
	MOUSE_EVENT_ONDRAG("ondrag", events("drag")),
	MOUSE_EVENT_ONDRAGEND("ondragend", events("dragend")),
	MOUSE_EVENT_ONDRAGENTER("ondragenter", events("dragenter")),
	MOUSE_EVENT_ONDRAGLEAVE("ondragleave", events("dragleave")),
	MOUSE_EVENT_ONDRAGOVER("ondragover", events("dragover")),
	MOUSE_EVENT_ONDRAGSTART("ondragstart", events("dragstart")),
	MOUSE_EVENT_ONDROP("ondrop", events("drop")),
	MOUSE_EVENT_ONMOUSEDOWN("onmousedown", events("mousedown")),
	MOUSE_EVENT_ONMOUSEMOVE("onmousemove", events("mousemove")),
	MOUSE_EVENT_ONMOUSEOUT("onmouseout", events("mouseout")),
	MOUSE_EVENT_ONMOUSEOVER("onmouseover", events("mouseover")),
	MOUSE_EVENT_ONMOUSEUP("onmouseup", events("mouseup")),
	MOUSE_EVENT_ONMOUSEWHEEL("onmousewheel", events("mousewheel")),
	MOUSE_EVENT_ONSCROLL("onscroll", events("scroll")),
	KEYBOARD_EVENT_ONKEYDOWN("onkeydown", events("keydown")),
	KEYBOARD_EVENT_ONKEYPRESS("onkeypress", events("keypress")),
	KEYBOARD_EVENT_ONKEYUP("onkeyup", events("keyup")),
	AUTOFOCUS("autofocus"),
	DISABLED("disabled"),
	FORM("form"),
	LIST("list"),
	MAXLENGTH("maxlength"),
	PATTERN("pattern"),
	PLACEHOLDER("placeholder"),
	READONLY("readonly"),
	REQUIRED("required"),
	SIZE("size");
	
	private String name;
	private String property;
	private String[] events = {};

	private AttributeType(String name) {
		this.name = name;
		this.property = name;
	}
	
	private AttributeType(String name, String[] events) {
		this.name = name;
		this.property = name;
		this.events = events;
	}
	
	private AttributeType(String name, String property) {
		this.name = name;
		this.property = property;
	}

	public String getName() {
		return name;
	}
	
	public String getProperty() {
		return property;
	}
	
	public String[] getEvents() {
		return events;
	}
	
	private static String[] events(String... events) {
		return events;
	}

}
